package duoqiao;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class A1 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        while (true){
            System.out.println("请输入文件名");
            String fileName = scan.nextLine();
            File file = new File(fileName);
            if (file.exists()){
                file.delete();
                System.out.println("该文件已删除");
            }else {
                System.out.println("该文件不存在,不用删除");
                break;
            }
        }


















//        Scanner scan = new Scanner(System.in);
//         while (true){
//             String fileName = scan.nextLine();
//             File file = new File(fileName);
//             if (file.exists()){
//                 System.out.println("该文件已存在！");
//             }else {
//                 file.createNewFile();
//                 System.out.println("该文件以创建");
//                 break;
//             }
//         }

    }
}
